﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace System
{
    /// <summary>
    /// 忽略大小写,作为Contaions方法的参数
    /// </summary>
    public class StringComparisonIgnoreCase:IEqualityComparer<string>
    {

        public int GetHashCode(string t)
        {
            return t.GetHashCode();
        }
        /// <summary>
        /// 重写它的Equals，保存同时重写GetHashCode
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        public bool Equals(string x, string y)
        {
            return (x ?? string.Empty).Trim().ToUpper() == (y ?? string.Empty).Trim().ToUpper();
        }

    }
}
